Processing devices, for example, microcontrollers, are widely used in the industry as control elements in many solutions. Most microcontrollers are general in purpose, and are designed for use in a wide variety of applications. One such application is battery charging. Rechargeable batteries are used in many applications to power a variety of electronic devices (e.g., cell phones, laptop computers, personal digital assistants (PDAs), small electronic devices, and the like). Battery charging functionality may be realized on or using a microcontroller, for example, programmable system on a chip device (e.g., a PSoC® device manufactured by Cypress Semiconductor Corporation of San Jose, Calif.), which allows designers to build very small portable devices and to fit the electronics into a small battery package.
Certain types of batteries, for example, Lithium-based (Li+) batteries, are very sensitive to the charge voltage, current and discharge time. Therefore, they require a protective circuit. The protective circuit protects the battery from overcharge and over-discharge, and limits the load and charge current to safe values.
In one conventional programmable system on a chip device, separate resistors are utilized in the protective circuit for selecting the battery charger's charging current and its over-current shutdown level. On disadvantage of such a configuration is that it requires the use of additional pins on the device. Another disadvantage is that the system has to be pre-programmed for a particular charging current, thereby, no flexibility is provided.